#include <algorithm>
#include <cstdio>

typedef unsigned long long ull;
int n, pri[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
ull Ans = 0x7fffffffffffffff;

inline void min(ull &a, ull b) {
  if (a > b) a = b;
}

void dfs(short step, ull ans, int p, int cnt) {
  if (step > 15 || cnt > n || ans > Ans) return;
  if (cnt == n) return min(Ans, ans);
  for (int i = 1; i <= p; ++i) { dfs(step + 1, ans *= pri[step], i, cnt * (i + 1)); }
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("CF27E.in", "r", stdin);
  freopen("CF27E.out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  dfs(0, 1, 64, 1);
  printf("%llu", Ans);
  return 0;
}